package com.puzzle;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import android.widget.AdapterView.OnItemSelectedListener;

public class PuzzleActivity1 extends Activity {
    /** Called when the activity is first created. */

    EditText str1;
    String choice;
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.menu1);
        str1= (EditText)findViewById(R.id.editText1);
        String[] items = new String[] {"Select","Picture Puzzle", "Number Puzzle"};
        Spinner spinner = (Spinner) findViewById(R.id.spinner1);
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
                    android.R.layout.simple_spinner_item, items);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinner.setAdapter(adapter);
       
        spinner.setOnItemSelectedListener(new MyOnItemSelectedListener());
        
       
       
    }
  
    
    public class MyOnItemSelectedListener implements OnItemSelectedListener {

        public void onItemSelected(AdapterView<?> parent,View view, int pos, long id) 
        {
        Toast.makeText(parent.getContext(), "The Puzzle Game Type:- " + parent.getItemAtPosition(pos).toString(), Toast.LENGTH_LONG).show();
        str1.setText(parent.getItemAtPosition(pos).toString());
              
        }

        @SuppressWarnings("unchecked")
		public void onNothingSelected(AdapterView parent) {
          // Do nothing.
        }
		
    }


}

